home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / amiga.arexx / comp.lang.rexx_718_000005.msg next >
Encoding:
Text File  |  1994-11-27  |  1.3 KB  |  53 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: dd.chalmers.se!news.chalmers.se!sunic!pipex!howland.reston.ans.net!cs.utexas.edu!asuvax!ennews!mcdphx!schbbs!waccvm.corp.mot.com!ACUS02
  3. From: ACUS02@waccvm.corp.mot.com (David McAnally)
  4. Subject: Re: Parsing Data
  5. Organization: Motorola
  6. Date: Wed, 26 Jan 94 20:01:36 MST
  7. Message-ID: <16F4A119A9S86.ACUS02@waccvm.corp.mot.com>
  8. References:  <2i6es7$vt@delphinium.cig.mot.com>
  9. Sender: news@schbbs.mot.com (Net News)
  10. Nntp-Posting-Host: waccvm.corp.mot.com
  11. Lines: 41
  12.  
  13. In article <2i6es7$vt@delphinium.cig.mot.com>
  14. bachww@ferret.cig.mot.com (Bud Bach) writes:
  15.  
  16. >
  17. >Hi, I need to parse some data.  The data looks like:
  18. >
  19. >  'f1|f2|f3|f4...'
  20. >
  21. >where fn is field data.  My first cut at it was:
  22. >
  23. >  d = 'pp|t|123|John Smith|555-1212'
  24. >  parse var d with f1 '|' f2 '|' f3 '|' f4
  25. >  say f1 '*' f2 '*' f3 '*' f4
  26. >
  27. >The result was:
  28. >
  29. >   * pp * t * 123 * John Smith|555-1212
  30. >
  31. >The problem is that it seems to drop the first field.
  32. >
  33. >Am I doing something wrong?
  34. >
  35. >Is there a better way tgo do this?
  36. >
  37. >This is under os/2 2.1 -- Bud
  38. >
  39.  
  40. Just change the parse line to either ...
  41.  
  42.   parse value d with f1 '|' f2 '|' f3 '|' f4
  43.  
  44. or...
  45.  
  46.   parse var d f1 '|' f2 '|' f3 '|' f4
  47.  
  48.  
  49. Regards,
  50. David McAnally
  51. CSS Applications Engineering
  52. Motorola
  53.